<template>
    <p>这是Home页</p>
    <h1>JS跳转</h1>
    <button @click="pushStr">push-字符串-跳转</button>
    <button @click="pushPath">push-path-跳转</button>
    <button @click="pushName">push-name-跳转</button>
    <button @click="pushNameParams">push-name-跳转-params</button>
    <button @click="pushNameQuery">push-path-跳转-query</button>
</template>

<script>
export default {
    methods:{
        pushStr(){
            this.$router.push('/about')
        },
        pushPath(){
            this.$router.push({path:'/about'})
        },
        pushName(){
            this.$router.push({name:'about'})
        },
        pushNameParams(){
            this.$router.push({name:'about', state:{params:{id:1, name:'tom'}}})
        },
        pushNameQuery(){
            this.$router.push({path:'/about', query:{id:1, name:'tom'}})
        }
    },
    mounted(){ // 加载完之后
        console.log('this.$route',this.$route);
        console.log('this.$router',this.$router);
    }
}
</script>